<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>七牛上传图片</title>
	<style>
		#img-up{padding: 5px;background: #dcdcdc;width: 100px;text-align: center;cursor: pointer;}
		#img-up:hover{background: #ececec;}
		#img-show{width: 300px;height: 200px;border:1px solid #ccc;margin-top: 10px;}
	</style>
</head>
<body>
	<div id="img-up">上传图片</div>
	<div id="img-show">
		<img src="" id="img-show-box" width="300" height="200" alt="">
	</div>
</body>
<script src="script/jquery.min.js"></script>
<script src="script/moxie.js"></script>
<script src="script/plupload.dev.js"></script>
<script src="script/qiniu.js"></script>
<script src="script/ui.js"></script>
<script src="script/server.js"></script>
<script src="script/qiniu.main.js"></script>
<script src="script/highlight.js"></script>
<script type="text/javascript">hljs.initHighlightingOnLoad();</script>
<script>
	// 获得tokend 从后台获取
	var token;
	server.getData('',"http://140.143.3.210/3ccg/getUpToken",function(res){
		if(res.code==0){
			token = res.data;
		}
		// 文件名字 -- 修改上传图片的名字
		var filename = new Date();
		filename = filename.toLocaleString();
		filename = filename.replace(/[^0-9]/ig,"")+"brand";
		/*
		 	params1  : 上传凭证 从后台获得
			params2	 ：上传图片的名字
			params3	 : 上传图片按钮Id值
			params4	 :显示图片的位置
		*/
		upImgQiniu.qiniuImg(token,filename,'img-up','img-show-box');
	})
</script>
</html>